<?php

// +----------------------------------------------------------------------
// | H1CMS © OpenSource CMS
// +----------------------------------------------------------------------
// | Copyright (c) 2014-2016 http://www.h1cms.com All rights reserved.
// | Copyright (c) 2014-2016 嘉兴领格信息技术有限公司，并保留所有权利。
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: Allen <allen@lg4.cn>
// +----------------------------------------------------------------------

namespace Lg\View\Engines;

use Lg\View\Engine;
use Smarty;

/**
 * Description of PhpEngine
 *
 * @author Allen <allen@lg4.cn>
 */
class SmartyEngine extends Smarty implements Engine {

    public $debug = false;

    public function render($path, $data = array(), $outputReturn = false) {
        if (is_array($data)) {
            foreach ($data as $key => $value) {
                $this->assign($key, $value);
            }
        }
        if ($outputReturn) {
            return $this->fetch(basename($path));
        } else {
            $this->display(basename($path));
        }
    }

}
